package com.hliu.shiro.model;

import com.hliu.core.model.BaseModel;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.List;

/**
 * author: 6
 * date: 13-4-18
 */
@Entity
@Table(name = "fc_role")
public class Role extends BaseModel {
	private String roleName;
	private String description;
	private List<User> users;
	private List<Permission> permissions;

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@ManyToMany(mappedBy = "roles")
	public List<User> getUsers() {
		if (users == null) {
			users = new ArrayList();
		}
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	@ManyToMany(mappedBy = "roles")
	public List<Permission> getPermissions() {
		if (permissions == null) {
			permissions = new ArrayList();
		}
		return permissions;
	}

	public void setPermissions(List<Permission> permissions) {
		this.permissions = permissions;
	}
}
